//---------------------------------------------------------------------------
#ifndef uCalcOOH
#define uCalcOOH
//---------------------------------------------------------------------------
#include "uCalcCommon.h"
//---------------------------------------------------------------------------
class COOCalc;
//---------------------------------------------------------------------------
class COOColumn : public CCalcColumn
{
  private:
    int  __fastcall GetWidth( void);
    void __fastcall SetWidth( int nWidth);

  public:
    __fastcall COOColumn( CCalc *pOpenOffice, Variant vColumn);
};
//---------------------------------------------------------------------------
class COOColumns : public CCalcColumns
{
  private:
    COOColumn *m_Column;

    int          __fastcall GetCount( void);
    CCalcColumn *__fastcall GetItem( int c);

  public:
            __fastcall  COOColumns( CCalc *pOpenOffice, Variant vColumns);
    virtual __fastcall ~COOColumns( void);
};
//---------------------------------------------------------------------------
class COOStyle : virtual public CCalcStyle
{
  private:
    long        __fastcall GetBackgroundColor( void);
    void        __fastcall SetBackgroundColor( long lColor);
    CBorders    __fastcall GetBorders( void);
    void        __fastcall SetBorders( const CBorders &eBorders);
    CTextAlign  __fastcall GetTextAlign( void);
    void        __fastcall SetTextAlign( const CTextAlign &eAlign);
    TFontStyles __fastcall GetFontStyle( void);
    void        __fastcall SetFontStyle( const TFontStyles &eStyle);
    bool        __fastcall GetLocked( void);
    void        __fastcall SetLocked( bool bLocked);

  public:
    __fastcall COOStyle( CCalc *pOpenOffice);
};
//---------------------------------------------------------------------------
class COOCell : public CCalcCell, public COOStyle
{
  private:
    AnsiString __fastcall GetText( void);
    void       __fastcall SetText( const AnsiString &strText);
    Currency   __fastcall GetMoney( void);
    void       __fastcall SetMoney( const Currency &curValue);
    TDateTime  __fastcall GetDate( void);
    void       __fastcall SetDate( const TDateTime &dtValue);

  public:
    __fastcall COOCell( CCalc *pOpenOffice, Variant vCell);
};
//---------------------------------------------------------------------------
class COOCells : public CCalcCells
{
  private:
    COOCell *m_Cell;

    CCalcCell *__fastcall GetItem( int x, int y);

  public:
           __fastcall  COOCells( CCalc *pOpenOffice, Variant vCells);
   virtual __fastcall ~COOCells( void);
};
//---------------------------------------------------------------------------
class COORange : public CCalcRange, public COOStyle
{
  public:
    __fastcall COORange( CCalc *pOpenOffice, Variant vRange);
};
//---------------------------------------------------------------------------
class COOWorksheet : public CCalcWorksheet
{
  private:
    COOCells   *m_Cells;
    COORange   *m_Range;
    COOColumns *m_Columns;

    CCalcCells   *__fastcall GetCells( void);
    CCalcColumns *__fastcall GetColumns( void);
    AnsiString    __fastcall GetName( void);
    void          __fastcall SetName( const AnsiString &strName);

  public:
            __fastcall  COOWorksheet( CCalc *pOpenOffice, Variant vWorksheet);
    virtual __fastcall ~COOWorksheet( void);

    CCalcRange *__fastcall GetRange( int x1, int y1, int x2, int y2);
    void        __fastcall Protect( const AnsiString &strPassword);
};
//---------------------------------------------------------------------------
class COOWorksheets : public CCalcWorksheets
{
  private:
    COOWorksheet *m_Worksheet;

    CCalcWorksheet *__fastcall GetItem( int nIndex);
    int             __fastcall GetCount( void);

  public:
            __fastcall  COOWorksheets( CCalc *pOpenOffice, Variant vWorksheets);
    virtual __fastcall ~COOWorksheets( void);

    void __fastcall Add( void);
};
//---------------------------------------------------------------------------
class COOWorkbook : public CCalcWorkbook
{
  friend COOCalc;
  
  private:
    Variant        m_vWorkbooks;
    COOWorksheets *m_Worksheets;

    CCalcWorksheets *__fastcall GetWorksheets( void);

  protected:
    void __fastcall SetVisible( bool bVisible);

  public :
            __fastcall  COOWorkbook( CCalc *pOpenOffice);
    virtual __fastcall ~COOWorkbook( void);

    void __fastcall Create( void);
    void __fastcall Open  ( const AnsiString &strFilename);
    void __fastcall SaveAs( const AnsiString &strFilename);
};
//---------------------------------------------------------------------------
class PACKAGE_OUTILS COOCalc : public CCalc
{
  private:
    COOWorkbook *m_Workbook;
    bool         m_bVisible;

    bool           __fastcall GetVisible( void);
    void           __fastcall SetVisible( bool bVisible);

    CCalcWorkbook *__fastcall GetWorkbook( void);

  public:
         __fastcall  COOCalc( void);

    void __fastcall Init( void);
    void __fastcall Terminate( void);
};
//---------------------------------------------------------------------------
#endif
